package com.yym.duotai.com.yym;



public class duotaisan {
    public static void main(String[] args) {
        Person person = new Person();
        Anima anima = new Anima();
        Dog dog = new Dog();
        Eat eat = new Eat();

        //person.fed(dog);//狗仔吃饭
        person.fed(eat);//猫仔吃饭
    }
}

class Person{
public void fed(Anima anima){
//anima.eat();
anima.eat();
        }
        }

class Anima {
    public void eat() {
        System.out.println("动物在吃饭");
    }
}

class Dog extends Anima {
    public void eat() {
        System.out.println("为狗吃饭");
    }
}

class Eat extends Anima {
    public void eat() {
        System.out.println("猫在吃饭");
    }
}